import { uploadType } from '@/utils/util'

export const importConfig = {
	tabSteps: [
		{
			label: '下载模板',
			download: '下载模板',
			active: 1,
			rules: [
				{
					label: '下载最新导入模板。共1个：',
					children: [
						{
							label: '《隐患评估数据模板》',
							link: true,
							url: 'view_dpDangerAssess_downloadTemplate',
						},
					],
				},
			],
		},
		{
			label: '导入信息',
			description: '',
			uploadTip: '隐患评估数据',
			active: 2,
			url: 'view_dpDangerAssess_import',
			code: 3001,
			rules: [
				{
					label: '导入规则说明:',
					children: [
						{
							label: '(1)导入模式为“覆盖导入”，待导入的信息会覆盖平台已存在的',
						},
					],
				},
			],
		},
	],
	dataType: 89,
}

export const formConfig = {
	inline: false,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '机构统一社会信用代码',
			prop: 'creditCode',
			maxlength: '18',
			showWordLimit: true,
			type: 'text',
			span: 8,
			labelPosition: 'top',
			rules: [{ required: true, message: '请输入统一社会信用代码' }],
		},
		{
			label: '服务组织机构名称',
			prop: 'organizationName',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请输入服务组织机构名称' }],
		},
		{
			label: '隐患类型',
			prop: 'dangerType',
			propName: 'dangerTypeLabel',
			type: 'remoteSelect',
			code: 'DANGER_TYPE',
			api: 'getDictItemList',
			dataType: 'number',
			filterKey: 'value',
			multiple: false,
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请选择隐患类型' }],
		},
		{
			label: '隐患紧急程度',
			prop: 'dangerLevel',
			propName: 'dangerLevelLabel',
			type: 'remoteSelect',
			code: 'DANGER_LEVEL',
			api: 'getDictItemList',
			dataType: 'number',
			filterKey: 'value',
			multiple: false,
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请选择隐患紧急程度' }],
		},
		{
			label: '隐患内容',
			prop: 'dangerContent',
			maxlength: '500',
			showWordLimit: true,
			type: 'textarea',
			labelPosition: 'top',
			autosize: {
				minRows: 1,
			},
			span: 16,
			rules: [{ required: true, message: '请输入隐患内容' }],
		},
		{
			label: '负责人姓名',
			prop: 'dutyUser',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请输入负责人姓名' }],
		},
		{
			label: '负责人联系方式',
			prop: 'dutyUserPhone',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请输入负责人联系方式' }],
		},
		{
			label: '检查人',
			prop: 'checkUser',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请输入检查人' }],
		},
		{
			label: '检查时间',
			prop: 'checkDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			changeField: false,
			labelPosition: 'top',
			span: 8,
			rules: [{ required: true, message: '请选择检查时间' }],
		},
		{
			label: '整改负责人',
			prop: 'rectificationDutyUser',
			type: 'text',
			labelPosition: 'top',
			span: 8,
		},
		{
			label: '整改时间',
			prop: 'rectificationDate',
			type: 'date',
			format: 'YYYY年MM月DD日',
			valueFormat: 'YYYY-MM-DD',
			changeField: false,
			labelPosition: 'top',
			span: 8,
		},
		{
			label: '整改说明',
			prop: 'rectificationIllustrate',
			type: 'text',
			labelPosition: 'top',
			span: 8,
		},
		{
			label: '整改证明材料',
			prop: 'rectificationEvidence',
			type: 'upload',
			fileType: uploadType.fileMetaType,
			listType: 'text',
			labelPosition: 'top',
			showFileList: true,
			limit: 9,
			multiple: true,
			span: 24,
		},
		{
			label: '备注',
			prop: 'assessNote',
			type: 'text',
			labelPosition: 'top',
			span: 24,
		},
	],
}

export const searchConfig = {
	inline: true,
	showBtn: true,
	labelPosition: 'left',
	column: [
		{
			label: '机构统一社会信用代码',
			prop: 'creditCode',
			maxlength: '18',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '服务组织机构名称',
			prop: 'organizationName',
			maxlength: '50',
			showWordLimit: true,
			type: 'text',
			span: 8,
		},
		{
			label: '隐患类型',
			prop: 'dangerType',
			propName: 'dangerTypeLabel',
			type: 'remoteSelect',
			code: 'DANGER_TYPE',
			api: 'getDictItemList',
			dataType: 'number',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
		{
			label: '隐患紧急程度',
			prop: 'dangerLevel',
			propName: 'dangerLevelLabel',
			type: 'remoteSelect',
			code: 'DANGER_LEVEL',
			api: 'getDictItemList',
			dataType: 'number',
			filterKey: 'value',
			multiple: false,
			span: 8,
		},
	],
}

export const tableConfig = {
	stripe: true,
	border: true,
	columns: [
		// { label: '机构统一社会信用代码', prop: 'creditCode' },
		{ label: '服务组织机构', prop: 'organizationName' },
		{ label: '隐患类型', prop: 'dangerTypeLabel' },
		{ label: '隐患内容', prop: 'dangerContent' },
		{ label: '隐患紧急程度', prop: 'dangerLevelLabel' },
		{ label: '检查人', prop: 'checkUser' },
		{ label: '检查时间', prop: 'checkDate' },
		{
			label: '是否可信',
			prop: 'isBelievable',
			custome: 'tag',
			dicData: [
				{ label: '否', value: 0,type:'danger' },
				{ label: '是', value: 1,type:'success' },
			],
		},
		{
			label: '操作',
			prop: 'menu',
			width: 300,
			fixed: 'right',
		},
	],
}

export const api = {
	index: 'view_dpDangerAssess_page',
	add: 'view_dpDangerAssess_add',
	edit: 'view_dpDangerAssess_edit',
	delete: 'view_dpDangerAssess_del',
	export: 'view_dpDangerAssess_export',
	import: 'view_dpDangerAssess_import',
}
export const baseConfig = {
	pageName: '隐患评估数据',
	dictcodes: ['DANGER_TYPE', 'DANGER_LEVEL'],
	rowKey: 'id',
	addLabel: '新增',
	tipLabel: 'organizationName',
	exportMqTopic: '/ning/export/',
	paramsObj: {
		code: 3001,
	},
	api,
	auth: {
		index: 'view_dpDangerAssess_page',
		// add: 'view_dpDangerAssess_add',
		// edit: 'view_dpDangerAssess_edit',
		delete: 'view_dpDangerAssess_del',
		// export: 'view_dpDangerAssess_export',
		// import: 'view_dpDangerAssess_import',
		mulitSet: 'mulitSet',
	},
	menuBtn: [
		// {
		// 	icon: 'editor',
		// 	label: '编辑',
		// 	type: 'primary',
		// 	operate: 'edit',
		// 	auth: 'view_dpDangerAssess_edit',
		// 	text: true,
		// 	show: true,
		// },
		{
			icon: 'detail',
			label: '查看详情',
			type: 'primary',
			operate: 'detail',
			auth: 'view_dpDangerAssess_page',
			text: true,
			show: true,
		},
		// {
		// 	icon: 'delete',
		// 	label: '删除',
		// 	type: 'danger',
		// 	operate: 'delete',
		// 	auth: 'view_dpDangerAssess_del',
		// 	text: true,
		// 	show: true,
		// },
	],

	saveFormate: async (form) => {
		return new Promise((resolve, reject) => {
			resolve(form)
		})
	},
	dialogConfig: {
		width: '75%',
	},
	searchConfig,
	formConfig,
	tableConfig,
	importConfig,
	detailConfig: formConfig,
}
